How to Install Short{Paste} on Ubuntu Server Latest

Short{Paste} is a lightweight web application that allows you to easily share text and code snippets with others. It's completely open source and can be installed on any server that meets the minimum requirements. In this tutorial, we will guide you through the steps to install Short{Paste} on Ubuntu Server Latest.

Prerequisites

Before we start with the installation process, there are a few prerequisites that you should have installed in your system:

Step 1: Install Required Dependencies

Short{Paste} requires several PHP extensions to be installed on your system. Run the following commands to install them.

sudo apt-get update
sudo apt-get install php7.1 php7.1-fpm php7.1-mysql php7.1-curl php7.1-mbstring

Step 2: Configure Web Server

Short{Paste} supports both Nginx and Apache web servers. In this tutorial, we will assume you are using Nginx.

Install Nginx

sudo apt-get install nginx

Create Virtual Host

Create a new file called shortpaste.conf in /etc/nginx/sites-available directory with the following content:

server {
    listen 80;
    listen [::]:80;

    root /var/www/html/shortpaste/web;

    index index.php index.html index.htm;

    server_name your-domain-name.com;

    location / {
        try_files $uri /index.php$is_args$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.1-fpm.sock;
    }
}

Make sure to replace your-domain-name.com with your actual domain name.

Create a symlink to this file in /etc/nginx/sites-enabled directory.

sudo ln -s /etc/nginx/sites-available/shortpaste.conf /etc/nginx/sites-enabled/

Remove the default Nginx configuration file.

sudo rm /etc/nginx/sites-enabled/default
sudo rm /etc/nginx/sites-available/default

Restart Nginx.

sudo systemctl reload nginx

Step 3: Install Short{Paste}

Clone the Repository

Clone the Short{Paste} repository to /var/www/html/shortpaste.

sudo git clone https://github.com/adyanth/shortpaste.git /var/www/html/shortpaste

Install Dependencies

Navigate to the shortpaste directory.

cd /var/www/html/shortpaste

Install the required dependencies using composer.

sudo composer install --no-dev --optimize-autoloader

Configure Database

Create a new database for Short{Paste}.

mysql -uroot -p
mysql> CREATE DATABASE shortpaste;
mysql> GRANT ALL PRIVILEGES ON shortpaste.* TO 'shortpaste'@'localhost' IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;
mysql> exit;

Make a copy of the .env.dist file to .env.

cp .env.dist .env

Change the following lines in the .env file.

APP_ENV=prod
APP_SECRET=random-string-here
DATABASE_URL=mysql://shortpaste:password@localhost/shortpaste

Replace random-string-here with a random string of your choice.

Generating SSH Keys

Generate a new SSH key pair that will be used to encrypt and decrypt the snippets.

mkdir var/jwt
openssl genrsa -out var/jwt/private.pem -aes256 4096
openssl rsa -pubout -in var/jwt/private.pem -out var/jwt/public.pem

Load the Fixtures

Load the initial data into the database.

php bin/console doctrine:fixtures:load -n

Set Permissions

Update the permissions of the var directory.

sudo chown -R www-data:www-data var

Step 4: Testing

Open your browser and type http://your-domain-name.com.

You should see the Short{Paste} homepage.

Congratulations! You have successfully installed Short{Paste} on your Ubuntu Server Latest.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!